<!doctype html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml" xmlns:v-on="http://www.w3.org/1999/xhtml" xmlns:v-model="http://www.w3.org/1999/xhtml" xmlns:v-demo="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        .router-link-active {
            color:#f00;
        }
        pre {
            font-family: sans-serif;
            font-size: 1em;
            line-height:1.5em;
        }

    </style>
</head>
<body>
    <div id="app">
        <p>
            <router-link to="/a">/a->b(静态指定重定向路由)</router-link> |
            <router-link to="/b">/b</router-link> |

            <router-link to="/c">/c->d(动态指定重定向路由)</router-link> |
            <router-link to="/d">/d</router-link>
        </p>

        <router-view class="view"></router-view>
    </div>
</body>

<script src="../../../vender/vue@2.4.2.js"></script>
<script src="../../../vender/vue-router@2.7.0.js"></script>

<script>
    const A={template:`<div>A</div>`};
    const B={template:`<div>B</div>`};
    const C={template:`<div>C</div>`};
    const D={template:`<div>D</div>`};

    const router=new VueRouter({
        routes:[
            {
                path:'/a',
                redirect:'/b'
            },
            {
                path:'/b',
                component:B
            },
            {
                path:'/c',
                redirect:to=>{
                    console.log(to);
                    return '/d';
                }
            },
            {
                path:'/d',
                component:D
            }
        ]
    });

    const app=new Vue({
        el:'#app',
        router
    });

</script>
</html>